import FSMBlackboard from "./FSMBlackboard";
import FSMCondition from "./FSMCondition";

export enum NumberCondition {
    GREATER,
    LESS,
    EQUALS,
    NOT_EQUALS,
}

export default class FSMConditionNumber extends FSMCondition<number> {
    private _condition: NumberCondition;

    constructor(name: string, value: number, condition: NumberCondition) {
        super(name, value);
        this._condition = condition;
    }
    
    public tick(data: FSMBlackboard): boolean {
        super.tick(data);
        switch (this._condition) {
            case NumberCondition.GREATER:
                return this._currValue > this.targetValue;
            case NumberCondition.LESS:
                return this._currValue < this.targetValue;
            case NumberCondition.EQUALS:
                return this._currValue === this.targetValue;
            case NumberCondition.NOT_EQUALS:
                return this._currValue !== this.targetValue;
        }
    }
}
